/*
 * CS202 Dr. Michael Peterson
 * student: Deylo Woo (dwoo711@gmail.com)
 * Battleship
 */
package battleship;

import java.util.Scanner;

/**
 *
 * Main
 */
public class Main {

    private static Scanner _kb = new Scanner(System.in);

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        boolean _keepPlaying = false;
        do {
            PlayGame();
            System.out.println("Play again?");
            String response = _kb.nextLine();
            if (response.toLowerCase().contains("y")) {
                _keepPlaying = true;
            } else {
                _keepPlaying = false;
            }
        } while (_keepPlaying);
    }

    /**
     * Start the game
     */
    public static void PlayGame() {
        GameManager _game = new GameManager();
        System.out.println("Battleship game v. 1.0");
        _game.GenerateGrid(10, 10);
        _game.PrintGrid();
        _game.GenerateShip(5, 5, "Aircraft Carrier");
        _game.GenerateShip(4, 4, "Battleship");
        _game.GenerateShip(4, 4, "Battleship");
        _game.GenerateShip(3, 3, "Submarine");
        _game.GenerateShip(3, 3, "Torpedo ship");
        _game.GenerateShip(2, 2, "Destroyers");
        _game.GenerateShip(2, 2, "Destroyers");
        _game.PlaceShipsOnGrid();
        _game.PlayGame();
        System.out.println("------- game over --------");
        System.out.println();
        System.out.println();
    }
}
